Hello everybody,

I am new in C, but I need to modify a code to make it faster.
After adding timers, it seems that one of the biggest time consumer in this code is where strcmp is used: it compares MANY strings.

As an example here could be one list of strings: "object_out", "object_in", "object_1", "object_204", "object_log", "backup" ...

My understanding of strcmp is that it compares one by one the characters until it finds a difference. If for instance I want to look for "object_204" and "object_out", it will compare the "o", "b", ... "_" and then will find a difference between "2" and "o" and return 0.

So my idea was, since the differences will most of the time come from the end of the string (all prefixes are not the same, but most of them yes), to compare instead the end first, and go in reverse order.

Do you think this will be faster? Also as a beginner, I am afraid I will create an imperfect version of this function and would gladly get some help to be as efficient as possible.

Thanks!